Skip to content

[host]: SystemTagCreator ignoreIfExisting to prevent duplicate tags#3950

Open
MatheMatrix wants to merge 1 commit into
5.5.22from
sync/songtao.liu/fix/ZSTAC-58237-v2
Open

[host]: SystemTagCreator ignoreIfExisting to prevent duplicate tags#3950
MatheMatrix wants to merge 1 commit into
5.5.22from
sync/songtao.liu/fix/ZSTAC-58237-v2

Conversation

@MatheMatrix
Copy link
Copy Markdown
Owner

Resolves: ZSTAC-58237

sync from gitlab !9841

updateHostConnectedTime 中 check-then-act 存在竞态窗口: 并发重连时
两线程同时读到 !tagExists, 第二个 SystemTagCreator.create() 因
unique=true 抛异常。设置 ignoreIfExisting=true 使重复创建静默跳过。

Resolves: ZSTAC-58237

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: ba56aab2-dbce-4f7b-9ace-3f1e6cc5bae1

📥 Commits

Reviewing files that changed from the base of the PR and between 57a496a and 92bd989.

📒 Files selected for processing (1)
  • compute/src/main/java/org/zstack/compute/host/HostBase.java

Walkthrough

该PR在主机连接时间标签创建时添加了ignoreIfExisting = true配置,防止标签已存在时的创建失败。这是对主机状态更新逻辑的单行改进。

Changes

Host System Tag Configuration

Layer / File(s) Summary
Host Connected Time Tag Creation
compute/src/main/java/org/zstack/compute/host/HostBase.java
updateHostConnectedTime方法中的SystemTagCreator配置添加ignoreIfExisting = true标志,允许在HostSystemTags.HOST_CONNECTED_TIME标签已存在时安全跳过创建。

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 一行代码轻轻改,
主机标签不再失败,
存在则忽略,简单又纯粹,
连接时间标签,平安无忧。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地描述了主要变更:在SystemTagCreator中设置ignoreIfExisting来防止重复标签,与提供的代码摘要完全一致。
Description check ✅ Passed 描述与变更集相关,提供了JIRA票号和GitLab同步引用,虽然简洁但足以关联到修复的并发问题。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/songtao.liu/fix/ZSTAC-58237-v2

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant